﻿
USE [Pap.Database]
GO
/****** Object:  Table [dbo].[LoanPlaceTypes]    Script Date: 01/24/2010 13:43:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanPaymentMethod]    Script Date: 01/24/2010 13:43:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanLegalForms]    Script Date: 01/24/2010 13:43:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanHistoryCloseType]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Governorates]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[EducationalLevels]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardLoanStatus]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MilitaryStatuses]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MarketParticipant]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_PADDING ON
GO
/****** Object:  Table [dbo].[LoanType]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Projects]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Permissions]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Roles]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Users]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[SocialStatuses]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[RolesPermissions]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersRoles]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersCommittees]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ProjectStages]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MPWorkFlow]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Centers]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Committees]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[IssuePlace]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Villages]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommittessVillages]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Board]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Customers]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerPhones]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoans]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttendees]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttachments]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardLoans]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoanHistory]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearch]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudy]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearchAttachments]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudyAttachments]    Script Date: 01/24/2010 13:43:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

/****** Object:  Table [dbo].[wfProcesses]    Script Date: 01/23/2010 21:51:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActionTypes]    Script Date: 01/23/2010 21:51:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfConditions]    Script Date: 01/23/2010 21:51:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MarketParticipant]    Script Date: 01/23/2010 21:51:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
/****** Object:  Table [dbo].[wfProcessInstances]    Script Date: 01/23/2010 21:51:41 ******/
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfSteps]    Script Date: 01/23/2010 21:51:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MPWorkFlow]    Script Date: 01/23/2010 21:51:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActions]    Script Date: 01/23/2010 21:51:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepInstances]    Script Date: 01/23/2010 21:51:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepRoles]    Script Date: 01/23/2010 21:51:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

USE [PapDB]
GO
/****** Object:  Table [dbo].[LoanPlaceTypes]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanPaymentMethod]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanLegalForms]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Projects]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Permissions]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MilitaryStatuses]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanType]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Governorates]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[EducationalLevels]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ImageTypes]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfProcesses]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfConditions]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActionTypes]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Users]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[SocialStatuses]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanHistoryCloseType]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Roles]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ReceiptType]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[RolesPermissions]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfProcessInstances]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersRoles]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfSteps]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Receipts]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ProjectStages]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UserMessages]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Images]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_PADDING ON
GO
/****** Object:  Table [dbo].[Centers]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Committees]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[IssuePlace]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActions]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Villages]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepRoles]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepInstances]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersCommittees]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommittessVillages]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Board]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Customers]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttendees]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttachments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerPhones]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoans]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearch]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardLoans]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoanHistory]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecution]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCases]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCancellingDebts]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudy]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecutionInstallments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecutionAttachments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCancellingDebtAttachments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearchAttachments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudyAttachments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanInstallmentPayments]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanIntstallmentWarnings]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanInstallmentWarningAttachment]    Script Date: 04/08/2010 13:38:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

USE [PapDB]
GO
/****** Object:  Table [dbo].[LoanPlaceTypes]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanPaymentMethod]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanLegalForms]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Projects]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Permissions]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[MilitaryStatuses]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanType]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Governorates]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[EducationalLevels]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ImageTypes]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfProcesses]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfConditions]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActionTypes]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Users]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[SocialStatuses]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanHistoryCloseType]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Roles]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ReceiptType]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[RolesPermissions]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfProcessInstances]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersRoles]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfSteps]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Receipts]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[ProjectStages]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UserMessages]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Images]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_PADDING ON
GO
/****** Object:  Table [dbo].[Centers]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Committees]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[IssuePlace]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfActions]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Villages]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepRoles]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[wfStepInstances]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[UsersCommittees]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommittessVillages]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Settings]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Board]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[Customers]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttendees]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardAttachments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerPhones]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoans]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearch]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[BoardLoans]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CustomerLoanHistory]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecution]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCases]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCancellingDebts]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudy]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecutionInstallments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanExecutionAttachments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanCancellingDebtAttachments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanSocialResearchAttachments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanFeasabilityStudyAttachments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanInstallmentPayments]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanIntstallmentWarnings]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[LoanInstallmentWarningAttachment]    Script Date: 04/08/2010 13:41:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

USE [Pap.Database]
GO
/****** Object:  Table [dbo].[AssociationBankAccount]    Script Date: 04/19/2010 22:09:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountDeposites]    Script Date: 04/19/2010 22:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountMainBranchDeposites]    Script Date: 04/19/2010 22:09:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountExpenses]    Script Date: 04/19/2010 22:09:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountDepositAttachments]    Script Date: 04/19/2010 22:09:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountDepositReceipts]    Script Date: 04/19/2010 22:09:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[AssociationBankAccountMainBranchDepositAttachments]    Script Date: 04/19/2010 22:09:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

/****** Object:  Table [dbo].[CommitteeBankAccount]    Script Date: 04/19/2010 22:09:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountDeposites]    Script Date: 04/19/2010 22:09:12 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountMainBranchDeposites]    Script Date: 04/19/2010 22:09:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountExpenses]    Script Date: 04/19/2010 22:09:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountDepositAttachments]    Script Date: 04/19/2010 22:09:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountDepositReceipts]    Script Date: 04/19/2010 22:09:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Table [dbo].[CommitteeBankAccountMainBranchDepositAttachments]    Script Date: 04/19/2010 22:09:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

USE [PapDB]
GO
/****** Object:  Table [dbo].[MainBranchDeposits]    Script Date: 05/11/2010 13:29:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

GO

--Syntax Error: Incorrect syntax near ,.
--CREATE TABLE Sync.Settings_Tracking
--(
--    ,
--    Version RowVersion NOT NULL,
--	IsDeleted bit NOT NULL default 0,
--	LastUpdatedDate datetime NULL
--)

GO
--Syntax Error: Incorrect syntax near (.
--
--CREATE TRIGGER Settings_Tracking_Insert
--ON [dbo].[Settings] 
--AFTER INSERT
--AS 
--BEGIN
--	INSERT INTO Sync.Settings_Tracking ( ,IsDeleted,LastUpdatedDate)
--	SELECT ,0,NULL
--	FROM INSERTED
--END 

GO
--Syntax Error: Incorrect syntax near END.
--
--CREATE TRIGGER Settings_Tracking_Update
--ON [dbo].[Settings] 
--AFTER Update
--AS 
--BEGIN
--	UPDATE Sync.Settings_Tracking 
--	SET LastUpdatedDate  = getdate()
--    FROM Sync.Settings_Tracking s JOIN INSERTED i
--    ON 
--END
--

GO
--Syntax Error: Incorrect syntax near END.
--
--CREATE TRIGGER Settings_Tracking_Delete
--ON [dbo].[Settings] 
--AFTER delete
--AS 
--BEGIN
--	UPDATE Sync.Settings_Tracking 
--	SET LastUpdatedDate  = getdate(),
--		IsDeleted = 1
--	FROM Sync.Settings_Tracking s JOIN DELETED i
--    ON 
--END
--

GO
--Syntax Error: Incorrect syntax near SELECT.
--
--create PROCEDURE Sync.SP_Settings_SelectChanges
--@LastRowVersion rowversion,
--@FilterdColumn UNIQUEIDENTIFIER
--AS 
--BEGIN 
--	SELECT 
--        ,
--		g.[Key],g.[Value],g.[CommitteeID],g.[ID],
--		t.IsDeleted,
--		t.LastUpdatedDate
--	FROM [dbo].[Settings] g RIGHT JOIN Sync.Settings_Tracking t  
--    ON  
--	WHERE @LastRowVersion IS NULL OR t.Version > @LastRowVersion
--        AND (@FilterdColumn IS NULL OR g.CommitteeID = @FilterdColumn)
--    END 
--

GO
--Syntax Error: Incorrect syntax near ,.
--
--create PROCEDURE Sync.SP_Settings_ApplyChanges
--@RawValues XML 
--AS 
--BEGIN
--	 
--		DECLARE @Settings_Temp TABLE 
--		(
--			,
--			[Key] nvarchar(50),
--				[Value] nvarchar(50),
--				[CommitteeID] uniqueidentifier,
--				[ID] int,
--			IsDeleted BIT, 
--			LastUpdatedDate DATETIME
--		)
--		
--	   INSERT INTO @Settings_Temp 
--	   SELECT	,
--                Tbl.Col.value('Key[1]', 'nvarchar(50)') [Key],
--
--Tbl.Col.value('Value[1]', 'nvarchar(50)') [Value],
--
--Tbl.Col.value('CommitteeID[1]', 'uniqueidentifier') [CommitteeID],
--
--Tbl.Col.value('ID[1]', 'int') [ID],
--				Tbl.Col.value('IsDeleted[1]', 'bit') IsDeleted,
--				Tbl.Col.value('LastUpdatedDate[1]','DateTime') LastUpdatedDate
--	   FROM   @RawValues.nodes('/DocumentElement/Settings') Tbl(Col)
------------------------------------------------------------------------------------------
--
---- Insert ------------------------------------------------------------------------------
--
--	INSERT INTO [dbo].[Settings] (,[Key],[Value],[CommitteeID],[ID])
--	SELECT ,t.[Key],t.[Value],t.[CommitteeID],t.[ID]
--	FROM  @Settings_Temp t
--	WHERE t.IsDeleted = 0
--    AND NOT EXISTS
--    (
--        SELECT 1 FROM sync.Settings_Tracking s
--        WHERE 
--    )
--	-- put conflicts here.
--	
---- Update -------------------------------------------------------------------------------
--     
--	UPDATE [dbo].[Settings]
--	SET [Settings].[Key] = t.[Key],[Settings].[Value] = t.[Value],[Settings].[CommitteeID] = t.[CommitteeID],[Settings].[ID] = t.[ID] 
--	FROM [dbo].[Settings] s JOIN @Settings_Temp t 
--    ON 
--	WHERE	t.IsDeleted = 0 
--	AND		t.LastUpdatedDate IS NOT NULL
--	AND		t.LastUpdatedDate >= 
--				 isnull((SELECT TOP 1 LastUpdatedDate 
--				  FROM sync.Settings_Tracking r
--				  WHERE )
--                  ,t.LastUpdatedDate)
--	-----------------------------------------------------------------------------------------
--
---- Delete -------------------------------------------------------------------------------
--
--	DELETE [dbo].[Settings]
--    FROM @Settings_Temp t JOIN [dbo].[Settings] s
--    ON 
--	WHERE t.IsDeleted = 1
--
-------------------------------------------------------------------------------------------
--	
--END 
--



GO

--Syntax Error: Incorrect syntax near (.
--
--CREATE TRIGGER Settings_Tracking_Insert
--ON [dbo].[Settings] 
--AFTER INSERT
--AS 
--BEGIN
--	INSERT INTO Sync.Settings_Tracking ( ,IsDeleted,LastUpdatedDate)
--	SELECT ,0,NULL
--	FROM INSERTED
--END 

GO
--Syntax Error: Incorrect syntax near END.
--
--CREATE TRIGGER Settings_Tracking_Update
--ON [dbo].[Settings] 
--AFTER Update
--AS 
--BEGIN
--	UPDATE Sync.Settings_Tracking 
--	SET LastUpdatedDate  = getdate()
--    FROM Sync.Settings_Tracking s JOIN INSERTED i
--    ON 
--END
--

GO
--Syntax Error: Incorrect syntax near END.
--
--CREATE TRIGGER Settings_Tracking_Delete
--ON [dbo].[Settings] 
--AFTER delete
--AS 
--BEGIN
--	UPDATE Sync.Settings_Tracking 
--	SET LastUpdatedDate  = getdate(),
--		IsDeleted = 1
--	FROM Sync.Settings_Tracking s JOIN DELETED i
--    ON 
--END
--

GO
--Syntax Error: Incorrect syntax near WHERE.
--
--create PROCEDURE Sync.SP_Settings_SelectChanges
--@LastRowVersion rowversion,
--@FilterdColumn UNIQUEIDENTIFIER
--AS 
--BEGIN 
--	SELECT 
--        g.[Key],g.[Value],g.[CommitteeID],g.[ID],
--		t.IsDeleted,
--		t.LastUpdatedDate
--	FROM [dbo].[Settings] g RIGHT JOIN Sync.Settings_Tracking t  
--    ON  
--	WHERE @LastRowVersion IS NULL OR t.Version > @LastRowVersion
--        AND (@FilterdColumn IS NULL OR g.CommitteeID = @FilterdColumn)
--    END 
--

GO
--Syntax Error: Incorrect syntax near (.
--
--create PROCEDURE Sync.SP_Settings_ApplyChanges
--@RawValues XML 
--AS 
--BEGIN
--	 
--		DECLARE @Settings_Temp TABLE 
--		(
--			[Key] nvarchar(50),
--				[Value] nvarchar(50),
--				[CommitteeID] uniqueidentifier,
--				[ID] int,
--			IsDeleted BIT, 
--			LastUpdatedDate DATETIME
--		)
--		
--	   INSERT INTO @Settings_Temp 
--	   SELECT	
--                Tbl.Col.value('Key[1]', 'nvarchar(50)') [Key],
--
--Tbl.Col.value('Value[1]', 'nvarchar(50)') [Value],
--
--Tbl.Col.value('CommitteeID[1]', 'uniqueidentifier') [CommitteeID],
--
--Tbl.Col.value('ID[1]', 'int') [ID],
--				Tbl.Col.value('IsDeleted[1]', 'bit') IsDeleted,
--				Tbl.Col.value('LastUpdatedDate[1]','DateTime') LastUpdatedDate
--	   FROM   @RawValues.nodes('/DocumentElement/Settings') Tbl(Col)
------------------------------------------------------------------------------------------
--
---- Insert ------------------------------------------------------------------------------
--
--	INSERT INTO [dbo].[Settings] (,[Key],[Value],[CommitteeID],[ID])
--	SELECT t.[Key],t.[Value],t.[CommitteeID],t.[ID]
--	FROM  @Settings_Temp t
--	WHERE t.IsDeleted = 0
--    AND NOT EXISTS
--    (
--        SELECT 1 FROM sync.Settings_Tracking s
--        WHERE 
--    )
--	-- put conflicts here.
--	
---- Update -------------------------------------------------------------------------------
--     
--	UPDATE [dbo].[Settings]
--	SET [Settings].[Key] = t.[Key],[Settings].[Value] = t.[Value],[Settings].[CommitteeID] = t.[CommitteeID],[Settings].[ID] = t.[ID] 
--	FROM [dbo].[Settings] s JOIN @Settings_Temp t 
--    ON 
--	WHERE	t.IsDeleted = 0 
--	AND		t.LastUpdatedDate IS NOT NULL
--	AND		t.LastUpdatedDate >= 
--				 isnull((SELECT TOP 1 LastUpdatedDate 
--				  FROM sync.Settings_Tracking r
--				  WHERE )
--                  ,t.LastUpdatedDate)
--	-----------------------------------------------------------------------------------------
--
---- Delete -------------------------------------------------------------------------------
--
--	DELETE [dbo].[Settings]
--    FROM @Settings_Temp t JOIN [dbo].[Settings] s
--    ON 
--	WHERE t.IsDeleted = 1
--
-------------------------------------------------------------------------------------------
--	
--END 
--



GO
